// 一边压缩，Gzip 压缩 解压 
const { createReadStream, createWriteStream } = require('fs');
const { pipeline } = require('stream');
const { createGzip } = require('zlib');

const gzip = createGzip();
const source = createReadStream('index.html');
const destination = createWriteStream('index.html.gz');

pipeline(source, destination, (err) => {
    if(err) {
        console.log(err);
    } 
})